<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        body {
            margin: 0;
            padding: 12px;
            font-family: Arial, sans-serif;
            font-size: 14px;
            display: flex;
            flex-direction: column;
            height: 100vh;
            box-sizing: border-box;
        }

        .control-section {
            margin-bottom: 12px;
            display: flex;
            gap: 8px;
            align-items: center;
        }

        #select-button {
            padding: 8px 16px;
            background-color: #4285f4;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
        }

        #select-button.active {
            background-color: #34a853;
        }

        #select-button:hover {
            opacity: 0.9;
        }

        .preview-section {
            margin-bottom: 12px;
        }

        .preview-label {
            font-weight: bold;
            color: #666;
            font-size: 12px;
            margin-bottom: 4px;
        }

        .preview-content {
            padding: 8px;
            background-color: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 4px;
            word-break: break-all;
            max-height: 60px;
            overflow-y: auto;
        }

        .xpath-section {
            display: flex;
            gap: 8px;
            align-items: center;
            margin-bottom: 4px;
        }

        .xpath-content {
            flex: 1;
            padding: 8px;
            background-color: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 4px;
            word-break: break-all;
            font-family: 'Consolas', 'Monaco', monospace;
            font-size: 13px;
        }

        .copy-xpath-button {
            padding: 4px 8px;
            background-color: #f1f3f4;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            white-space: nowrap;
        }

        .copy-xpath-button:hover {
            background-color: #e8eaed;
        }

        #xpath-tree {
            flex: 1;
            overflow-y: auto;
            margin-top: 16px;
            border-top: 1px solid #ddd;
            padding-top: 16px;
        }

        .tree-item {
            padding: 4px 8px;
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
            border-radius: 3px;
            margin: 1px 0;
        }

        .tree-item:hover {
            background-color: rgba(66, 133, 244, 0.1);
        }

        .tree-item.selected {
            background-color: rgba(66, 133, 244, 0.2);
        }

        .tree-item.highlight {
            background-color: rgba(66, 133, 244, 0.15);
            border-left: 2px solid #4285f4;
        }

        .tree-indent {
            margin-left: 20px;
        }

        .tree-expand {
            display: inline-block;
            width: 16px;
            height: 16px;
            text-align: center;
            line-height: 16px;
            cursor: pointer;
            color: #666;
        }

        .tree-tag {
            color: #881391;
        }

        .tree-attr {
            color: #994500;
        }

        .tree-text {
            color: #1a1aa6;
            font-style: italic;
            margin-left: 4px;
        }
    </style>
</head>
<body>
    <div class="control-section">
        <button id="select-button">开始选择</button>
    </div>
    <div class="preview-section">
        <div class="xpath-label">XPath</div>
        <div class="xpath-section">
            <div class="xpath-content" id="xpath-content"></div>
            <button class="copy-xpath-button" id="copy-xpath">复制</button>
        </div>
    </div>
    <div class="preview-section">
        <div class="preview-label">文本内容</div>
        <div class="preview-content" id="text-content"></div>
    </div>
    <div class="preview-section">
        <div class="preview-label">HTML代码</div>
        <div class="preview-content" id="html-content"></div>
    </div>
    <div id="xpath-tree"></div>
    <script src="panel.js"></script>
</body>
</html>